#include "StdAfx.h"
#include "Message.h"

#define USES_IID_IMAPIProp
#define USES_IID_IMessage
#include <InitGuid.h>
#include <MAPIGuid.h>

CMessage::CMessage(LPINNEROBJ_T pObj) : m_pObj( pObj ), m_cRef( 1 )
{
	static char * szFun = "CMessage::CMessage";
	LogEntry(szFun);

	if ( m_pObj ) {
		m_pObj->AddRef();
	}
}

CMessage::~CMessage(void)
{
	static char * szFun = "CMessage::~CMessage";
	LogEntry(szFun);

	if ( m_pObj ) {
		m_pObj->Release();
	}
}


//////////////////////////////////////////////////////////////////////////
// Implementation IUnknown
STDMETHODIMP CMessage::QueryInterface (REFIID riid, LPVOID * ppvObj)
{
	static char * szFun = "CMessage::";
	LogEntry(szFun);

	*ppvObj = NULL;

	if ( riid == IID_IMessage ||
		riid == IID_IMAPIProp ||
		riid == IID_IUnknown ) {
			*ppvObj = (LPVOID)this;
			AddRef();
			return S_OK;
	} else {
		*ppvObj = NULL;
		return E_NOINTERFACE;
	}
}


STDMETHODIMP_(ULONG) CMessage::AddRef ()
{
	static char * szFun = "CMessage::";
	LogEntry(szFun);

	if ( !m_pObj ) {
		return NULL;
	}

	++m_cRef;
	m_pObj->AddRef();
	return m_cRef;
}


STDMETHODIMP_(ULONG) CMessage::Release ()
{
	static char * szFun = "CMessage::";
	LogEntry(szFun);

	if (!m_pObj) {
		return NULL;
	}

	ULONG ulRef =  m_pObj->Release();

	--m_cRef;
	if (m_cRef == 0) {
		m_pObj = NULL;
		delete this;
		return 0;
	}

	return ulRef;
}

//////////////////////////////////////////////////////////////////////////
// IMessage
HRESULT CMessage::CreateAttach(
							   LPCIID lpInterface,
							   ULONG ulFlags,
							   ULONG FAR * lpulAttachmentNum,
							   LPATTACH FAR * lppAttach
							   )
{
	static char * szFun = "CMessage::";
	LogEntry(szFun);

	return MAPI_E_NO_SUPPORT;
}




HRESULT CMessage::DeleteAttach(
							   ULONG ulAttachmentNum,
							   ULONG_PTR ulUIParam,
							   LPMAPIPROGRESS lpProgress,
							   ULONG ulFlags
							   )
{
	static char * szFun = "CMessage::";
	LogEntry(szFun);

	return MAPI_E_NO_SUPPORT;
}


HRESULT CMessage::GetAttachmentTable(
									 ULONG ulFlags,
									 LPMAPITABLE FAR * lppTable
									 )
{
	static char * szFun = "CMessage::";
	LogEntry(szFun);

	return MAPI_E_NO_SUPPORT;
}


HRESULT CMessage::GetRecipientTable(
									ULONG ulFlags,
									LPMAPITABLE FAR * lppTable
									)
{
	static char * szFun = "CMessage::";
	LogEntry(szFun);

	return MAPI_E_NO_SUPPORT;
}


HRESULT CMessage::ModifyRecipients(
								   ULONG ulFlags,
								   LPADRLIST lpMods
								   )
{
	static char * szFun = "CMessage::";
	LogEntry(szFun);

	return MAPI_E_NO_SUPPORT;
}


HRESULT CMessage::OpenAttach(
							 ULONG ulAttachmentNum,
							 LPCIID lpInterface,
							 ULONG ulFlags,
							 LPATTACH FAR * lppAttach
							 )
{
	static char * szFun = "CMessage::";
	LogEntry(szFun);

	return MAPI_E_NO_SUPPORT;
}


HRESULT CMessage::SetReadFlag(
							  ULONG ulFlags
							  )
{
	static char * szFun = "CMessage::";
	LogEntry(szFun);

	return MAPI_E_NO_SUPPORT;
}


HRESULT CMessage::SubmitMessage(
								ULONG ulFlags
								)
{
	static char * szFun = "CMessage::";
	LogEntry(szFun);

	return MAPI_E_NO_SUPPORT;
}


//////////////////////////////////////////////////////////////////////////
// IMAPIProp
HRESULT CMessage::CopyProps(
							LPSPropTagArray lpIncludeProps,
							ULONG_PTR ulUIParam,
							LPMAPIPROGRESS lpProgress,
							LPCIID lpInterface,
							LPVOID lpDestObj,
							ULONG ulFlags,
							LPSPropProblemArray FAR * lppProblems
							)
{
	static char * szFun = "CMessage::";
	LogEntry(szFun);

	return MAPI_E_NO_SUPPORT;
}




HRESULT CMessage::CopyTo(
						 ULONG ciidExclude,
						 LPCIID rgiidExclude,
						 LPSPropTagArray lpExcludeProps,
						 ULONG_PTR ulUIParam,
						 LPMAPIPROGRESS lpProgress,
						 LPCIID lpInterface,
						 LPVOID lpDestObj,
						 ULONG ulFlags,
						 LPSPropProblemArray FAR * lppProblems
						 )
{
	static char * szFun = "CMessage::";
	LogEntry(szFun);

	return MAPI_E_NO_SUPPORT;
}


HRESULT CMessage::DeleteProps(
							  LPSPropTagArray lpPropTagArray,
							  LPSPropProblemArray FAR * lppProblems
							  )
{
	static char * szFun = "CMessage::";
	LogEntry(szFun);

	return MAPI_E_NO_SUPPORT;
}


HRESULT CMessage::GetIDsFromNames(
								  ULONG cPropNames,
								  LPMAPINAMEID FAR * lppPropNames,
								  ULONG ulFlags,
								  LPSPropTagArray FAR * lppPropTags
								  )
{
	static char * szFun = "CMessage::";
	LogEntry(szFun);

	return MAPI_E_NO_SUPPORT;
}


HRESULT CMessage::GetLastError(
							   HRESULT hResult,
							   ULONG ulFlags,
							   LPMAPIERROR FAR * lppMAPIError
							   )
{
	static char * szFun = "CMessage::";
	LogEntry(szFun);

	return MAPI_E_NO_SUPPORT;
}


HRESULT CMessage::GetNamesFromIDs(
								  LPSPropTagArray FAR * lppPropTags,
								  LPGUID lpPropSetGuid,
								  ULONG ulFlags,
								  ULONG FAR * lpcPropNames,
								  LPMAPINAMEID FAR * FAR * lpppPropNames
								  )
{
	static char * szFun = "CMessage::";
	LogEntry(szFun);

	return MAPI_E_NO_SUPPORT;
}


HRESULT CMessage::GetPropList(
							  ULONG ulFlags,
							  LPSPropTagArray FAR * lppPropTagArray
							  )
{
	static char * szFun = "CMessage::";
	LogEntry(szFun);

	return MAPI_E_NO_SUPPORT;
}


HRESULT CMessage::GetProps(
						   LPSPropTagArray lpPropTagArray,
						   ULONG ulFlags,
						   ULONG FAR * lpcValues,
						   LPSPropValue FAR * lppPropArray
						   )
{
	static char * szFun = "CMessage::";
	LogEntry(szFun);

	return MAPI_E_NO_SUPPORT;
}


HRESULT CMessage::OpenProperty(
							   ULONG ulPropTag,
							   LPCIID lpiid,
							   ULONG ulInterfaceOptions,
							   ULONG ulFlags,
							   LPUNKNOWN FAR * lppUnk
							   )
{
	static char * szFun = "CMessage::";
	LogEntry(szFun);

	return MAPI_E_NO_SUPPORT;
}


HRESULT CMessage::SaveChanges(
							  ULONG ulFlags
							  )
{
	static char * szFun = "CMessage::";
	LogEntry(szFun);

	return MAPI_E_NO_SUPPORT;
}


HRESULT CMessage::SetProps(
						   ULONG cValues,
						   LPSPropValue lpPropArray,
						   LPSPropProblemArray FAR * lppProblems
						   )
{
	static char * szFun = "CMessage::";
	LogEntry(szFun);

	return MAPI_E_NO_SUPPORT;
}
